package org.jeecg.modules.charge.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.entity.charge.ChargeFeeCategory;
import org.jeecg.modules.charge.entity.ChargeFeeitemTree;
import org.jeecg.modules.charge.mapper.ChargeFeeCategoryMapper;
import org.jeecg.modules.charge.service.IChargeFeeCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 收费项分类
 * @Author: jeecg-boot
 * @Date:   2021-06-24
 * @Version: V1.0
 */
@Service
public class ChargeFeeCategoryServiceImpl extends ServiceImpl<ChargeFeeCategoryMapper, ChargeFeeCategory> implements IChargeFeeCategoryService {

     @Autowired
     private ChargeFeeCategoryMapper chargeFeeRuleMapper;

    @Override
    public List<ChargeFeeCategory> getFeeCategory(Integer parentId) {
        QueryWrapper<ChargeFeeCategory> queryWrapper = new QueryWrapper();
        queryWrapper.eq("parent_id", parentId !=null ? parentId:1);
        List<ChargeFeeCategory> list = baseMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public Integer getFeeCategoryParentId(Integer id) {
        return chargeFeeRuleMapper.getFeeCategoryParentId(id);
    }

    @Override
    public List<ChargeFeeitemTree> getFeeCategoryTree() {
        return chargeFeeRuleMapper.getFeeCategoryTree();
    }
}
